<?php

namespace App\Http\Controllers\Home;

use Illuminate\Http\Request;
use Illuminate\Support\Facades\DB;
use Illuminate\Support\Facades\Hash;
use App\Http\Controllers\Controller;


class RegisterController extends Controller
{
    public function index(){	
        return view('home/register.index');
    }

    public function region(Request $request){
    	$password = Hash::make($request->user_pwd);
		$password = md5($request->user_pwd.'salt');

    	$showtime=time();
    	$result = DB::table('users')->insert(
    		[
    			'user_name'  => "$request->user_name",
    			'user_pwd'   => "$password",
    			'user_email' => "$request->user_email",
    			'user_tel'   => "$request->user_tel",
    			'user_time'  => "$showtime",
    		] 
    	);
    	if($result){
            return 1;
    	}
    }
}